/* cmw.t  CUSTOMER MASTER WRITE TRIGGER                                   */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/*All rights reserved worldwide.  This is an unpublished work.            */
/*V8:ConvertMode=NoConvert*/
/**************************************************************************/
/*  Program :cmw.t                                                        */
/*  Author  :Denis Tatarik                                                */
/*  Date    :07/20/98                                                     */
/*  Description: cm_mstr WRITE trigger program                            */
/*          In order to enhance this trigger to support additional        */
/*          interfaces, add a DO-END block similary to the one            */
/*          used for the Logistics Interface to (1) check for the         */
/*          need to continue processing; (2) move the relevant            */
/*          fields to an appropriate work area; and (3) call              */
/*          one or more subprograms to continue processing.               */
/*          This .t proram should remain short, relying on                */
/*          subprograms to perform most of the work.                      */
/**************************************************************************/
/*                             MODIFY LOG                                 */
/**************************************************************************/
/*Revision 8.6     Last Modified:  07/29/98 BY: *M009* Denis Tatarik      */
/*Revision 9.1     Last Modified:  09/07/99 BY: *N02H* Robert Jensen      */
/*Revision 9.1     Last Modified:  10/07/99 BY: *N03L* Robert Jensen      */
/*Revision 9.1     Last Modified:  08/11/00 BY: *N0KK* jyn                */
/*                                                                        */
/**************************************************************************/

/*N03L*/ /* Add argument to lgarex.p call */
TRIGGER PROCEDURE FOR WRITE OF CM_MSTR OLD BUFFER OLD_CM_MSTR.

        {mfdeclre.i}

/*fdn*/         define new shared work-table wf_old_cm_mstr like cm_mstr.

/*N03L*/define variable nPublished as integer no-undo.
/*M009 Commented out because of scope reductions in On/Q Logistics 1.1 */
/*N02H*//* Restored processing for Logistics in MFG/PRO 9.1 */
        /* Logistics Interface processing */
LG:     do:
/*N02H*/   /* If there is no logistics application ID, then do not process */
/*N02H*/   if can-find(first lgs_mstr no-lock
/*N02H*/   where lgs_mstr.lgs_app_id <> "")
/*N02H*/   then do:
/*N02H*/      /* Did the credit limit or balance change? */
/*N02H*/      if old_cm_mstr.cm_balance <> cm_mstr.cm_balance or
/*N02H*/      old_cm_mstr.cm_cr_limit <> cm_mstr.cm_cr_limit or
/*N02H*/      old_cm_mstr.cm_curr <> cm_mstr.cm_curr then do:
/*N02H*/         /* Yes, call logistics to process */
/*N02H*/         {gprunmo.i &module="LG"
/*N02H*/         &program="lgarex.p"
/*N03L*//*N02H*/ &param="""(input recid(cm_mstr), output nPublished)"""}
/*N02H*/      end.
/*N02H*/   end.
        end.


/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "cm_mstr" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(cm_mstr), input "cm_mstr").

    if not can-find ( first dt_mstr where dt_table = "cm_mstr" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_cm_mstr ) then do:
        create wf_old_cm_mstr.
        if recid(wf_old_cm_mstr)= -1 then .
    end.
    
    buffer-copy old_cm_mstr to wf_old_cm_mstr no-error.

    for each dt_mstr no-lock where dt_table = "cm_mstr" and dt_type = "MOD" :
    
        case dt_field :

            when "cm_addr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_addr, input cm_mstr.cm_addr,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ship" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_ship, input cm_mstr.cm_ship,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_type, input cm_mstr.cm_type,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_terms" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_cr_terms, input cm_mstr.cm_cr_terms,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_xslspsn" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_xslspsn, input cm_mstr.cm_xslspsn,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadi01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadi01), input string(cm_mstr.cm__qadi01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pr_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_pr_list, input cm_mstr.cm_pr_list,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_disc_pct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_disc_pct), input string(cm_mstr.cm_disc_pct),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_partial" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_partial), input string(cm_mstr.cm_partial),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_stmt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_stmt), input string(cm_mstr.cm_stmt),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_dun" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_dun), input string(cm_mstr.cm_dun),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fin" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_fin), input string(cm_mstr.cm_fin),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ar_acct" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_ar_acct, input cm_mstr.cm_ar_acct,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ar_cc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_ar_cc, input cm_mstr.cm_ar_cc,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc07, input cm_mstr.cm__qadc07,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc01, input cm_mstr.cm__qadc01,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_stmt_cyc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_stmt_cyc, input cm_mstr.cm_stmt_cyc,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_shipvia" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_shipvia, input cm_mstr.cm_shipvia,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_rmks" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_rmks, input cm_mstr.cm_rmks,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_resale" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_resale, input cm_mstr.cm_resale,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_region" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_region, input cm_mstr.cm_region,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qad04[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qad04[1]), input string(cm_mstr.cm__qad04[1]),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_sort" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_sort, input cm_mstr.cm_sort,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_balance" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_balance), input string(cm_mstr.cm_balance),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_taxable" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_taxable), input string(cm_mstr.cm_taxable),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pay_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_pay_date), input string(cm_mstr.cm_pay_date),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_xslspsn2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_xslspsn2, input cm_mstr.cm_xslspsn2,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadi02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadi02), input string(cm_mstr.cm__qadi02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_avg_pay" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_avg_pay), input string(cm_mstr.cm_avg_pay),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_user1, input cm_mstr.cm_user1,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_user2, input cm_mstr.cm_user2,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_curr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_curr, input cm_mstr.cm_curr,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_lang" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_lang, input cm_mstr.cm_lang,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_db" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_db, input cm_mstr.cm_db,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_hold" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_cr_hold), input string(cm_mstr.cm_cr_hold),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_rating" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_cr_rating, input cm_mstr.cm_cr_rating,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_high_cr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_high_cr), input string(cm_mstr.cm_high_cr),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_high_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_high_date), input string(cm_mstr.cm_high_date),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_sale_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_sale_date), input string(cm_mstr.cm_sale_date),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_invoices" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_invoices), input string(cm_mstr.cm_invoices),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fin_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_fin_date), input string(cm_mstr.cm_fin_date),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qad06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qad06), input string(cm_mstr.cm__qad06),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fst_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_fst_id, input cm_mstr.cm_fst_id,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pst_id" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_pst_id, input cm_mstr.cm_pst_id,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pst" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_pst), input string(cm_mstr.cm_pst),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_tax_in" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_tax_in), input string(cm_mstr.cm_tax_in),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_site, input cm_mstr.cm_site,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_class" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_class, input cm_mstr.cm_class,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_taxc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_taxc, input cm_mstr.cm_taxc,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_bill" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_bill, input cm_mstr.cm_bill,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr01, input cm_mstr.cm__chr01,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr02, input cm_mstr.cm__chr02,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr03, input cm_mstr.cm__chr03,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr04, input cm_mstr.cm__chr04,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr05, input cm_mstr.cm__chr05,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr06, input cm_mstr.cm__chr06,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr07, input cm_mstr.cm__chr07,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr08, input cm_mstr.cm__chr08,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr09, input cm_mstr.cm__chr09,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__chr10, input cm_mstr.cm__chr10,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__dte01), input string(cm_mstr.cm__dte01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__dte02), input string(cm_mstr.cm__dte02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__dec01), input string(cm_mstr.cm__dec01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__dec02), input string(cm_mstr.cm__dec02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__log01), input string(cm_mstr.cm__log01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc02, input cm_mstr.cm__qadc02,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fr_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_fr_list, input cm_mstr.cm_fr_list,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fr_terms" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_fr_terms, input cm_mstr.cm_fr_terms,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_mod_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_mod_date), input string(cm_mstr.cm_mod_date),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_userid" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_userid, input cm_mstr.cm_userid,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_conrep_logic" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_conrep_logic, input cm_mstr.cm_conrep_logic,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_slspsn[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_slspsn[1], input cm_mstr.cm_slspsn[1],
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fr_min_wt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_fr_min_wt), input string(cm_mstr.cm_fr_min_wt),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_drft_bal" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_drft_bal), input string(cm_mstr.cm_drft_bal),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_lc_bal" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_lc_bal), input string(cm_mstr.cm_lc_bal),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pr_list2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_pr_list2, input cm_mstr.cm_pr_list2,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_fix_pr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_fix_pr), input string(cm_mstr.cm_fix_pr),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_update" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_cr_update), input string(cm_mstr.cm_cr_update),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_review" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_cr_review), input string(cm_mstr.cm_cr_review),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_coll_mthd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_coll_mthd, input cm_mstr.cm_coll_mthd,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_drft_min" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_drft_min), input string(cm_mstr.cm_drft_min),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_drft_max" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_drft_max), input string(cm_mstr.cm_drft_max),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_drft_disc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_drft_disc), input string(cm_mstr.cm_drft_disc),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_drft_apv" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_drft_apv), input string(cm_mstr.cm_drft_apv),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_internal" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_internal), input string(cm_mstr.cm_internal),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_svc_list" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_svc_list, input cm_mstr.cm_svc_list,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_po_reqd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_po_reqd), input string(cm_mstr.cm_po_reqd),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_serv_terms" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_serv_terms, input cm_mstr.cm_serv_terms,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_cr_limit" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_cr_limit), input string(cm_mstr.cm_cr_limit),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_promo" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_promo, input cm_mstr.cm_promo,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_btb_cr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_btb_cr), input string(cm_mstr.cm_btb_cr),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_btb_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_btb_type, input cm_mstr.cm_btb_type,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ship_lt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_ship_lt), input string(cm_mstr.cm_ship_lt),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_btb_mthd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_btb_mthd), input string(cm_mstr.cm_btb_mthd),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ex_ratetype" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_ex_ratetype, input cm_mstr.cm_ex_ratetype,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_disc_comb" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_disc_comb, input cm_mstr.cm_disc_comb,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_scurr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_scurr, input cm_mstr.cm_scurr,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc03, input cm_mstr.cm__qadc03,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc04, input cm_mstr.cm__qadc04,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc05, input cm_mstr.cm__qadc05,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadc06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm__qadc06, input cm_mstr.cm__qadc06,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadd01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadd01), input string(cm_mstr.cm__qadd01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadd02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadd02), input string(cm_mstr.cm__qadd02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadl01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadl01), input string(cm_mstr.cm__qadl01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadl02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadl02), input string(cm_mstr.cm__qadl02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadl03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadl03), input string(cm_mstr.cm__qadl03),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadl04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadl04), input string(cm_mstr.cm__qadl04),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadt01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadt01), input string(cm_mstr.cm__qadt01),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadt02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadt02), input string(cm_mstr.cm__qadt02),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadi03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadi03), input string(cm_mstr.cm__qadi03),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm__qadi04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm__qadi04), input string(cm_mstr.cm__qadi04),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_ar_sub" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_ar_sub, input cm_mstr.cm_ar_sub,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_sic" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_sic, input cm_mstr.cm_sic,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_pay_method" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_pay_method, input cm_mstr.cm_pay_method,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_submit_prop" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_cm_mstr.cm_submit_prop), input string(cm_mstr.cm_submit_prop),
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

            when "cm_bank" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_cm_mstr.cm_bank, input cm_mstr.cm_bank,
                    input recid(cm_mstr), input cm_mstr.cm_addr, input "", input "", input "",
                    input "", input "", input "", input "").

        end.

    end.
end.

{hkdttrans.i}
